﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace GameVLTK
{
    public abstract class Control : Window
    {
        protected Control() { }

        public enum ControlState 
        { 
           IsClicked,
           IsHovered,
           None 
        };

        protected ControlState _State = ControlState.None;

        public ControlState State
        {
            get { return _State; }
            set { _State = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public virtual bool CheckClicked(MouseState mouseState)
        {
            if (mouseState.LeftButton == ButtonState.Pressed)
                if ((mouseState.X >= TopLeft.X && mouseState.X <= TopLeft.X + Size.X) &&
                   (mouseState.Y >= TopLeft.Y && mouseState.Y <= TopLeft.Y + Size.Y))
                    return true;

            return false;

        }

        /// <summary>
        /// 
        /// </summary>
        public virtual bool CheckHovered(MouseState mouseState)
        {
            if ((mouseState.X >= TopLeft.X && mouseState.X <= TopLeft.X + Size.X) &&
               (mouseState.Y >= TopLeft.Y && mouseState.Y <= TopLeft.Y + Size.Y))
                return true;

            return false;
        }
    }
}
